// src/api/comment.js
import request from "@/utils/request";

// 获取电影评论树
export const getCommentsByMovieId = (movieId) => {
  return request.get(`app/comment/movie/${movieId}`);
};

// 发布顶级评论
export const postComment = (comment) => {
  return request.post(`app/comment/save`, comment);
};

// 回复评论
export const replyComment = (parentId, reply) => {
  return request.post(`app/comment/reply/${parentId}`, reply);
};

// 点赞
export const likeComment = (id) => {
  return request.post(`app/comment/like/${id}`);
};
/**
 * 根据用户ID获取我的评论（时间倒序）
 * @param {String} userId 用户ID
 * @returns {Promise}
 */
export const getMyComments = (userId) => {
  return request.get(`app/comment/my`, {
    params: { userId }
  });
};
